<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <%@ include file="/WEB-INF/views/include/head.jsp"%> 
        <link rel="stylesheet" href="${ctxStatic}/css/list.css">
        <script type="text/javascript">
            function clean(){
                $("input").val("");
                $("#searchForm").submit();
            }
        </script> 
    </head>
    <body>
        <form  id="searchForm" action="${ctx}/sys/shop/list" method="post">
            <div class="listSearchBox clearfix">
                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                <div class="searchLeft clearfix">
                    <div class="searchSm clearfix">
                    <!--店铺编号-->
                        <p class="searchTxt"><spring:message code="shop_shopCode"/></p>
                        <div class="searchInp">
                            <input type="text" id="shopCode"  name="shopCode" value="${shop.shopCode}">
                        </div>
                    </div>
                    <div class="searchSm clearfix">
                        <!--店铺名称-->
                        <p class="searchTxt"><spring:message code="shop_shopName"/></p>
                        <div class="searchInp">
                            <input type="text" id="shopName"  name="shopName" value="${shop.shopName}" >
                        </div>
                    </div>
                </div>
                <div class="searchRight">
                    <shiro:hasPermission name="sys:shop:edit">
                        <button type="button" class="btn-cj" onclick="popup('935px','550px','${ctx}/sys/shop/form')"><spring:message code="common_create"/></button>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="sys:shop:view">
                        <button type="button" class="btn-js" onclick="clean()"><spring:message code="common_reset"/></button>
                        <button type="button" class="btn-js" onclick="return page();"><spring:message code="commom_check"/></button>
                    </shiro:hasPermission>
                </div>
            </div>
        </form>
        <div class="tableBox">
            <div class="tableBoxScroll">
                <table cellpadding="0">
                    <thead>
                        <tr>
                            <!--头部-->
                            <th>No.</th>
                            <!--店铺编号-->
                            <th><spring:message code="shop_shopCode"/></th>
                            <!--店铺名称-->
                            <th><spring:message code="shop_shopName"/></th>
                            <!--所在国家-->
                            <th><spring:message code="shop_hostCountry"/></th>
                            <!--所在城市-->
                            <th><spring:message code="shop_shopCity"/></th>
                            <!--联系人-->
                            <th><spring:message code="shop_contacts"/></th>
                            <!--联系电话-->
                            <th><spring:message code="shop_contactNumber"/></th>
                            <!--创建人-->
                            <th><spring:message code="shop_shopCreatUser"/></th>
                            <!--创建日期-->
                            <th><spring:message code="shop_shopCreatDate"/></th>
                        </tr>
                    </thead>
                    <c:if test="${not empty page.list}" >
                        <tbody>
                            <c:forEach items="${page.list}" var="shop" varStatus="status">
                                <tr>
                                    <td>
                                        <p>${(page.pageNo-1)*page.pageSize + status.index+1}</p>
                                    </td>
                                    <td>
                                        <shiro:hasPermission name="sys:shop:edit">
                                            <p class="show" onclick="popup('800px','470px','${ctx}/sys/shop/show?id=${shop.id}')">${shop.shopCode}</p>
                                        </shiro:hasPermission>
                                    </td>
                                    <td>
                                        <p>${shop.shopName}</p>
                                    </td>
                                    <td>
                                        <p> ${fns:getDictName(shop.shopCountry)}</p>
                                    </td>
                                    <td>
                                        <p>${fns:getDictName(shop.shopCity)}</p>
                                    </td>
                                    <td>
                                        <p>${shop.contactPerson}</p>
                                    </td>
                                    <td>
                                        <p>${shop.contactPhone}</p>
                                    </td>
                                    <td>
                                        <p>${shop.createBy.firstName}${shop.createBy.lastName}</p>
                                    </td>
                                    <td>
                                        <p><fmt:formatDate value="${shop.createDate}" pattern="yyyy-MM-dd HH:mm" /></p>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </c:if>
                </table>
                <c:if test="${empty page.list}" >
                    <div class="tableNone">
                        <img src="${ctxStatic}/images/icon-03.png" height="20"> <spring:message code="There_is_no_data"/>
                    </div>
                </c:if>
            </div>
            <%@ include file="/WEB-INF/views/include/page.jsp"%>
        </div>
        <script>
            var listH = $('body').css('height')
            $(window.parent.$("#mainFrame").css('height',listH));
            window.onload = function(){
                var theadW = $('.tabScroll thead').width();
                var theadTh = $('.tabScroll thead tr th').length;
                $('.tabScroll thead tr th').width(theadW/theadTh);
                $('.tabScroll tbody tr:first-child td').each(function(){
                    var indexNum = $(this).index();
                    var tdWidth = $('.tabScroll tbody tr:first-child td').eq(indexNum).css('width');
                    $('.tabScroll thead tr th').eq(indexNum).width(tdWidth);
                });
           }
        </script>
    </body>
</html>